package com.gp.testonline.service.impl;

import com.gp.testonline.dao.RppMapper;
import com.gp.testonline.eo.RppEOPage;
import com.gp.testonline.model.Rpp;
import com.gp.testonline.service.RppService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/*
 *实现业务及流程接口当中的内容
 */
@Service
public class RppServiceImpl implements RppService {
    @Autowired
    private RppMapper rppMapper;

    @Override
    public int InsertRpp(Rpp rpp) {
        int idInsert=0;
        /*1 没有相关业务流程的判断*/
        try{
            idInsert=rppMapper.insertRpp(rpp);
        }catch (Exception e){
            idInsert=-1;
            //打印更新时报错的情况
            System.out.println("添加信息时执行sql报错的原因为："+e.getMessage());
        }
        return idInsert;
    }

    @Override
    public int DeleteRpp(Integer rppid) {
        int isDelete=0;
        /*1 没有相关业务流程的判断*/
        try{
            isDelete=rppMapper.deleteRpp(rppid);
        }catch (Exception e){
            isDelete=-1;
            //打印更新时报错的情况
            System.out.println("删除信息时执行sql报错的原因为："+e.getMessage());
        }
        return isDelete;
    }

    @Override
    public List<RppEOPage> getRppAll(RppEOPage rppEOPage) {
        List<RppEOPage> listRppEo=rppMapper.getRppAll(rppEOPage);
        return listRppEo;
    }
}
